/*-------------------------------------------------------- 
* Module Name : OLInfoButton
* Version : 1.0
* 
* Software Name : Qt App Template
* Version : 1.0
*
* Copyright � 2010 � 2011 France T�l�com
* This software is distributed under the LGPL v2.1 license,
* the text of which is available at http://www.gnu.org/licenses/lgpl-2.1.html
* or see the "LICENSE.txt" file for more details.
*
*--------------------------------------------------------
* File Name   : OLInfoButton.h
*
* Created     : 07 June 2011
* Author(s)   : Omer Saleem
*
* Description :
* UI object for providing the info button area of the status
* bar. It gives the application battery, network and
* connectivity status.
*
*--------------------------------------------------------
* 1.0 - First open source release
*
*/

#ifndef OLINFOBUTTON_H
#define OLINFOBUTTON_H

#include <QWidget>

#include <QSystemDeviceInfo>
#include <QSystemNetworkInfo>

class QNetworkConfiguration;
class QNetworkConfigurationManager;
class QLabel;
class OLPixmapWidget;

QTM_USE_NAMESPACE

class OLInfoButton : public QWidget
{
    Q_OBJECT
public:
    explicit OLInfoButton(QWidget *parent = 0);

private slots:
    void handlePowerState(QSystemDeviceInfo::PowerState state);
    void handleBatteryLevel(int level);
    void handleNetworkMode(QSystemNetworkInfo::NetworkMode mode);
    void handleNetworkStatus(QSystemNetworkInfo::NetworkMode mode, QSystemNetworkInfo::NetworkStatus status);
    void handleSignalStrength(QSystemNetworkInfo::NetworkMode mode, int strength);

    void handleIapChange(const QNetworkConfiguration& config);

protected:
    // from QWidget
    //virtual void paintEvent(QPaintEvent* event);
    virtual void timerEvent(QTimerEvent *event);

private:
    QSystemNetworkInfo* m_netInfo;
    QNetworkConfigurationManager* m_netMan;
    QLabel* m_batteryIcon;
    bool m_isBattery;
    int m_batteryLevel;
    QLabel* m_networkIcon;
    QLabel* m_time;
    OLPixmapWidget* m_isRoaming;
    OLPixmapWidget* m_connectedGsm;
    OLPixmapWidget* m_connectedWifi;
};

#endif // OLINFOBUTTON_H
